#include"GSupport.h"

//**************************************************
//class GResponse
//**************************************************
GResponse::GResponse() {
	c = enone;
}

GResponse::GResponse(int in) {
	c = in;
}

string GResponse::getString() {
	switch(c) {
		case enone: return "No error.";
		case eloginpassword: return "Bad password.";
		case ealreadyloggedin: return "You are already logged in.";
		case eaccountdoesnotexist: return "Account does not exist.";
		case eaccountalreadyexists: return "Account already exists.";
		case echaracters: return "Username and password cannot contain white spaces or commas.";
		case estringlimit: return "Username and password cannot be longer than 15 characters.";
		case eusernotonline: return "User is not online.";
		case enotloggedin: return "You are not logged in.";
		case etransferstopped: return "The file transfer was stopped.";
		case everified: return "This account has already been verified";
		case enotverified: return "This account has not been verified yet.";
		case ebadverification: return "The string does not match the string in the image.";
		case einvalidpacket: return "The server received an invalid packet.";
	}
	return "Undefined error.";
}

QString GResponse::getServerString() {
	return QString::fromStdString(getString());
}

int GResponse::msgCode() {
	return c;
}

void GResponse::setMsgCode(int in) {
	c = in;
}
